<template>
	<view class="record">
		<uni-nav-bar fixed status-bar :border="false" left-icon="left" title="签到规则说明" @clickLeft="back" />
		<view class="infro_box" :style="'background-image: url(' + infro_box_bg+ ')'">
			<view class="left">
				<view class="top">
					<text v-if="type==1" class="on">已中奖</text>
					<text v-else>未中奖</text>

				</view>
				<view v-if="type==1" class="mid">
					<view>奖品名称</view>
					<view class="write_ff">
						<view>核销码:{{code}}</view>
						<view class="btn" @click="copyText">复制</view>
					</view>
				</view>
				<view v-else class="mid">送你一次免费抽奖<br />
					奖品名称 奖品名称 奖品名称
				</view>
				<view v-if="type==1" class="bottom" @click="goHxquery">点击兑奖</view>
				<view v-else class="bottom">去抽一次</view>
			</view>
			<view class="right">
				<image :src="`${imgPath}/upload/h5/lucky/record_banner.png`"></image>
			</view>
		</view>
		<view class="list_box">
			<view class="tit">幸运抽奖，233人中奖</view>
			<view class="list">
				<view class="left">
					<image :src="`${imgPath}/upload/h5/lucky/record_banner.png`></image>
				</view>
				<view class=" right">
						<text>大美丽</text>
						<p>奖品信息 大产品</p>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgPath: uni.imgPath,
				infro_box_bg: `${uni.imgPath}/upload/h5/lucky/record_bg.png`,
				type: 0,
				code: ""
			}
		},
		methods: {
			goHxquery() {
				uni.navigateTo({
					url: "/packages/hxquery/hxquery"
				})
			},
			back() {
				uni.navigateBack()
			},
			copyText() {
				wx.setClipboardData({
					data: this.code,
					success: function() {
						uni.showToast({
							title: '复制成功',
							icon: 'success'
						});
					},
					fail: function() {
						uni.showToast({
							title: '复制失败',
							icon: 'none'
						});
					}
				});
			}
		},
		onLoad() {
			var prize = uni.$store.state.prize;
			this.type = prize.type;
			this.code = prize.code;
		}
	}
</script>

<style lang="scss" scoped>
	.record {
		.infro_box {
			height: 423rpx;
			display: flex;


			background-size: cover;

			.left {
				display: flex;
				flex-direction: column;
				flex: 1;
				margin-left: 30rpx;

				.top {
					font-size: 44rpx;
					color: #868686;
					line-height: 44rpx;
					margin: 30px 0;

					&.on {
						color: #000;
					}
				}

				.mid {
					font-size: 28rpx;
					line-height: 46rpx;
					display: flex;
					flex-direction: column;

					.write_ff {
						display: flex;
						align-items: center;

						.btn {
							margin-left: 10rpx;
							width: 79rpx;
							height: 38rpx;
							line-height: 38rpx;
							background: #FFFFFF;
							border-radius: 8rpx;
							border: 1px solid #366FFA;
							color: #366FFA;
							font-size: 28rpx;
							text-align: center;
						}
					}
				}

				.bottom {
					width: 156rpx;
					height: 50rpx;
					background: #366FFA;
					border-radius: 12rpx;
					text-align: center;
					color: #fff;
					line-height: 50rpx;
					font-size: 28rpx;
					margin-top: 30rpx;

				}
			}

			.right {
				margin: 158rpx 20rpx 0 0;
				width: 246rpx;
				height: 183rpx;
				background: linear-gradient(139deg, #FFA06E 0%, #D04700 100%);
				border-radius: 22rpx;

				image {
					width: 246rpx;
					height: 183rpx;
				}
			}
		}

		.list_box {
			width: 710rpx;
			margin: 0 auto;
			background: #fff;
			border-radius: 22rpx;

			.tit {
				font-size: 32rpx;
				text-align: center;
				height: 99rpx;
				line-height: 99rpx;
				border-radius: 22rpx;
				background: #F5F8FF;
				color: #000;
				font-weight: bold;

			}

			.list {
				margin-top: 20rpx;
				display: flex;
				padding: 40rpx;

				.left {
					image {
						width: 84rpx;
						height: 84rpx;
					}
				}

				.right {
					display: flex;
					border-bottom: 1px solid #EEE;
					flex-direction: column;
					color: #868686;
					font-size: 26rpx;
					flex: 1;
					padding-bottom: 20rpx;
					margin-left: 20rpx;

					text {
						color: #000;
						font-weight: bold;
						margin: 10rpx 0;
					}
				}
			}
		}
	}
</style>